<?php 
    include_custom("/views/header.php");
?>
<?php if($room->isGoogleMap != 0): ?>
<script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?sensor=false&language=vi"></script>
<script type="text/javascript">
var map;
function initialize() {
      var myLatlng = new google.maps.LatLng(<?php echo $room->latitude; ?>,<?php echo $room->longitude; ?>);
      var myOptions = {
    zoom: 16,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("div_id"), myOptions); 
  // Biến text chứa nội dung sẽ được hiển thị
var text;
text= "<?php echo $room->contentGoogleMap; ?>";
   var infowindow = new google.maps.InfoWindow(
    { content: text,
        size: new google.maps.Size(100,50),
        position: myLatlng
    });
       infowindow.open(map);    
    var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map,
      title:"<?php echo $room->titleGoogleMap; ?>"
  });
}
</script>
<?php endif; ?>
<body <?php if($room->isGoogleMap != 0): ?> onLoad="initialize()" <?php endif; ?>>
<div id="container">
  <header id="header">
		<?php 
			include_custom("/views/header_menu.php");
		?>
  </header>
  <div id="main" role="main" class="search">
    <article class="search-content explore-apis">
		<div class="title">
        	<span><a href="index.php?rt=index/index">Home</a> > <a href="index.php?rt=index/view&id=<?php echo $room->id; ?>">Phòng Trọ</a></span>
            <ul>
                 <li>Sắp xếp theo: </li>
               	<li><a href="index.php?rt=index/index&order=1" class="active">Thời gian đăng</a></li>
                <li><a href="index.php?rt=index/index&order=2">Lượt view</a></li>
                <li><a href="index.php?rt=index/index&order=3">Gía Phòng</a></li>
                <li class="last"><a href="index.php?rt=index/index&order=4">Số lượng phòng trống</a></li>
        </div>
        <div class="nav">
        	<img src="skin/images/explore-choose.png" width="22" height="11">
        	<div class="apis categories"><a href="#" class="active">Tìm Kiếm</a></div>
            <div class="developer">
               
            	<a href="#"></a>
            </div><!-- end .developer-->
        </div><!-- end .nav-->
		
        <div class="content-main">
			<div id="contact">
				<div class="left">
					<img src="skin/images/NoImage.jpg">
				</div>
							
				<div class="right">
					<h1><?php echo $room->title; ?></h1>
					<p>Ngày tạo: <span class="time"><?php echo $room->create_date; ?></span></p>
					<p>Địa chỉ: <span class="bold"><?php if(strlen($room->address) != 0) echo $room->address; echo "N/A"; ?></span></p>
                    <?php 
                        $strDT = "";
                        if(strlen($room->dt_nha) != 0)
                        {
                            $strDT .= $room->dt_nha;    
                        }
                        if(strlen($room->dt_didong) != 0)
                        {
                            $strDT .= " - ".$room->dt_didong;
                        }
                        if(strlen($strDT) == 0)
                        {
                            $strDT = "N/A";
                        }
                    ?>
					<p>Điện thoại: <span class="bold"><?php echo $strDT; ?></span></p>
                    <p>Mô tả: s<span class="s"><?php echo $room->shortdescription; ?></span></p>
				</div>
				
				<div class="price">
					<ul>
						<li>Gía thấp nhất: <?php echo $room->gia_phong_min; ?></li>
						<li>Gía cao nhất: <?php echo $room->gia_phong_min; ?></li>
						<li>Số phòng còn trống: <?php echo $room->sophongcontrong; ?></li>
					</ul>
				</div>
			</div>
           <div id="block-info">
				<div id="info-contact">
					<ul class="ui-tabs-nav">
						<li><a href="#tab-1">Thông tin chung</a></li>
                        <?php if($room->isGoogleMap != 0): ?>
						<li><a href="#tab-2">Bản đồ</a></li>
                        <li><a href="#tab-3" id="dev_tab_3">Bình luận - Đánh giá</a></li>
                        <?php else:?>
                        <li><a href="#tab-2" id="dev_tab_2">Bình luận - Đánh giá</a></li>
                        <?php endif; ?>
                        
						
					</ul>
					
					<div id="tab-1">
						<table>
							<thead>
								<tr>
									<th>Đặc tính</th>
									<th>Giá trị</th>
								</tr>
							</thead>
							
							<tbody>
								<tr>
									<td>Tiêu đề</td>
									<td><?php echo $room->title; ?></td>
								</tr>
								<tr>
									<td>Mô tả</td>
									<td><?php echo $room->description; ?></td>
								</tr>
								<tr>
									<td>Phòng khép kín</td>
									<td><?php if($room->is_phong_khep_kin != 0) echo "Có phòng khép kín."; else echo "Không có phòng khép kín"; ?></td>
								</tr>
								<tr>
									<td>Địa chỉ</td>
									<td><?php if(strlen($room->address) != 0)echo $room->address; else echo "N/A"; ?></td>
								</tr>
								<tr>
									<td>Tổng số phòng</td>
									<td><?php echo $room->tongsophong; ?></td>
								</tr>
								<tr>
									<td>Số phòng còn trống</td>
									<td><?php echo $room->sophongcontrong; ?></td>
								</tr>
								<tr>
									<td>Tên chủ nhà</td>
									<td><?php echo $room->tenchunha; ?></td>
								</tr>
								<tr>
									<td>Điện thoại</td>
									<td><?php echo $strDT; ?></td>
								</tr>
								<tr>
									<td>Email</td>
									<td><?php echo $room->email; ?></td>
								</tr>
								<tr>
									<td>Giới tính thuê</td>
									<td><?php if($room->gioi_tinh_thue == 0) echo "Nam"; else if($room->gioi_tinh_thue == 1) echo "Nữ"; else echo "Nam - Nữ";?></td>
								</tr>
								<tr>
									<td>Giá phòng</td>
									<td><?php echo $room->gia_phong_min." - ".$room->gia_phong_max;?></td>
								</tr>
								<tr>
									<td>Giá điện</td>
									<td><?php if(strlen($room->giadien) != 0) echo $room->giadien; else echo "N/A";?></td>
								</tr>
								<tr>
									<td>Giá nước</td>
									<td><?php if(strlen($room->gia_nuoc) != 0) echo $room->gia_nuoc; else echo "N/A";?></td>
								</tr>
								<tr>
									<td>Gần chợ</td>
									<td><?php if($room->gan_cho != 0) echo "Gần chợ"; else echo "Không gần chợ"; ?></td>
								</tr>
								<tr>
									<td>Gần đường chính</td>
									<td><?php if($room->gan_duong != 0) echo "Gần đường chính"; else echo "Không gần đường chính"; ?></td>
								</tr>
								<tr>
									<td>Internet</td>
									<td><?php if($room->internet != 0) echo "Có mạng internet"; else echo "Không có mạng internet"; ?></td>
								</tr>
							</tbody>	
						</table>
					</div>
					
                    <?php if($room->isGoogleMap != 0): ?>
					<div id="tab-2">
                        <dir style="clear: both;"></dir>
						<div id="div_id" style="height:500px; width:830px"></div>
					</div>
                    <div id="tab-3">
                    <?php else:?>
                    <div id="tab-2">
                    <?php endif; ?>
					
						<div id="form-comment">
							<form method="get">
								<p class="title">
									Để lại lời nhận xét của bạn:           
								</p>
								<div id="name-email">
									<p class="line">
										<label for="comment_name">Tên:</label>
										<input type="text" maxlength="50" size="20" id="comment_name">
										<br /><span style="display: none" class="error" id="comment_name_error">Xin nhập tên</span>
									</p>
									<p class="line">
										<label for="comment_email">Email:</label>
										<input type="text" maxlength="50" size="20" id="comment_email">
										<br><span style="display: none" class="error" id="comment_email_error">Email không hợp lệ</span>
									</p>
                                    
                                    <p class="line">
										<label for="comment_title">Tiêu đề:</label>
										<input type="text" maxlength="50" size="20" id="comment_title">
										<br><span style="display: none" class="error" id="comment_title_error">Tiêu đề không hợp lệ</span>
									</p>
                                    
								</div>
								<p class="line comment">
									<label for="comment_text">Lời nhận xét:
									</label>
									<textarea cols="20" rows="7" id="comment_text"></textarea>
                                    <br><span style="display: none;margin-left: 150px;" class="error" id="comment_text_error">Bình luận không hợp lệ</span>
								</p>
                                <p>
                                    <br><span style="display: none" class="error" id="comment_error">Bình luận không hợp lệ. Xin vui lòng kiểm tra</span>
                                </p>
                                <p class="line comment">
                                    <input type="button" class="button" name="btnComment" id="btnComment" value="Submit" />
                                </p>
                                <input type="hidden" name="idRoom" id="idRoom" value="<?php echo $room->id; ?>" />
                                
							</form>
						</div>
					</div>
				</div>
			
				<p class="button btn_BaoThongTinSai">
                       <a href="#"><span class="api-running">Báo thông tin sai</span></a>
				</p>
		   </div>
        </div><!-- end .content-main-->
        
               <div id="sitebar">
        	<h3>Vị trí được chọn</h3>
			<div class="Container">
				<ul>
					<li>Huế</li>
				</ul>
			</div>
			<div id="home_distance_div">
				<div id="home_distance_selector">
					<h3>Lọc tìm kiếm của bạn
						<a title="Bắt đầu lại" href="#" id="l-startover">Bắt đầu lại</a>
					</h3>
					<ul id="city_select">
						<li>
							<form>
								<label id="title_set_city2">Nhập địa điểm</label>
								<input type="text" placeholder="Huế, Thừa Thiên Huế" class="place">
								<button type="submit">Chấp nhận</button>
							</form>
						</li>
					</ul>
				</div>
			</div>
			<div id="refine">
                <ul id="navigatorsUl">
					<li>
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="priceroom">Giá phòng:
							</span>
							<div id="Navigator_price" class="filter-range">
							<ul id="NavigatorUl_price" class="priceroom">
								<li>
									<input type="text" placeholder="Tối thiểu">
									-
									<input type="text" placeholder="Tối đa">
									<button type="submit">Filter</button>
								</li>
							</ul>
							</div>
						</form>
					</li>
					<li>
						<form>
							<span><img src="skin/images/expanded.gif" class="priceelec">Giá điện:</span>
							<div id="Navigator_bedrooms_sv_integer" class="filter-range">
								<ul id="NavigatorUl_bedrooms_sv_integer" class="priceelec">
									<li>
										<input type="text" placeholder="Tối thiểu">
										-
										<input type="text" placeholder="Tối đa">
										<button type="submit">Filter</button>
										
									</li>
								</ul>
							</div>
						</form>
					</li>
					<li>
						<form>
							<span><img src="skin/images/expanded.gif" class="pricewater">Giá nước:</span>
							<div id="Navigator_bedrooms_sv_integer" class="filter-range">
								<ul id="NavigatorUl_bedrooms_sv_integer" class="pricewater">
									<li>
										<input type="text" placeholder="Tối thiểu">
										-
										<input type="text" placeholder="Tối đa">
										<button type="submit">Filter</button>
									</li>
								</ul>
							</div>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="room">Phòng khép kín:
							</span>
								<ul id="room" class="room">
                                    <li class="element">
										<label>
											<input type="radio" name="room">Cả Hai
										</label>
									</li>
									<li class="element">
										<label>
											<input type="radio" name="room">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="room">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="gender">Giới tính thuê:</span>
								<ul class="gender" id="Navigator_AdType">
       	                            <li class="element">
										
										<label>
											<input type="radio"  name="gender">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gender">Nam
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gender">Nữ
										</label>
									</li>
								
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="image">Ảnh đại diện:</span>
								<ul class="image" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="image">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="image">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="image">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="internet">Internet:</span>
								<ul class="internet" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="internet" id="internet1">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="internet" id="internet1">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="internet" id="internet1">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="street">Gần đường:</span>
								<ul class="street" id="Navigator_AdType">
									<li class="element">
										
										<label>
											<input type="radio" name="street">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="street">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="market">Gần chợ:</span>
								<ul class="market" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="gan_cho">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_cho">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="gan_cho">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					<li id="Navigator_List_AdType">
						<form>
							<span>
								<img src="skin/images/expanded.gif" class="phone">Điện thoại:</span>
								<ul class="phone" id="Navigator_AdType">
                                    <li class="element">
										
										<label>
											<input type="radio" name="phone">Cả Hai
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="phone">Có
										</label>
									</li>
									<li class="element">
										
										<label>
											<input type="radio" name="phone">Không
										</label>
									</li>
								</ul>
						</form>
					</li>
					
					
					
                </ul> <!-- end navigatorsUl -->
            </div>
			
			
			
        </div><!--end .sitebar-->
    </article>
  </div>
  <footer id="footer"> 
  <?php
    include_custom("/views/footer.php");
?>
  </footer>
</div>
<!--! end of #container --> 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script>window.jQuery || document.write('<script src="skin/js/libs/jquery-1.7.1.min.js"><\/script>')</script> 

<!-- scripts concatenated and minified via ant build script--> 
<script src="skin/js/plugins.js"></script> 
<script src="skin/js/script.js"></script> 
<!-- end scripts--> 

<!--[if lt IE 7 ]>
	<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
	<script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
<![endif]--> 
<script type="text/javascript" src="skin/js/jquery.js"></script> 
<script type="text/javascript">
	$(document).ready(function(){	
        
        $("#btnComment").click(function(){
            var idRoom = $("#idRoom").val();
            var comment_name = $("#comment_name").val();
            var comment_email = $("#comment_email").val();
            var comment_text = $("#comment_text").val();
            var comment_title = $("#comment_title").val();
            var status = false;
            if(comment_name.length == 0)
            {
                $("#comment_name_error").show();
                status = true;
            }
            else
            {
                $("#comment_name_error").hide();
            }
            if(comment_email.length == 0)
            {
                status = true;
                $("#comment_email_error").show();
            }
            else
            {
                $("#comment_email_error").hide();
            }
            if(comment_text.length == 0)
            {
                status = true;
                $("#comment_text_error").show();
            }
            else
            {
                $("#comment_email_error").hide();
            }
            if(comment_title.length == 0)
            {
                status = true;
                $("#comment_title_error").show();
            }
            else
            {
                $("#comment_title_error").hide();
            }
            
            if(comment_text.length == 0)
            {
                status = true;
                $("#comment_text_error").show();
            }
            else
            {
                $("#comment_text_error").hide();
            }
            
            if(status)
                return false;
            
            $.ajax({
					url:"index.php?rt=index/comment",
					data:{idRoom:idRoom,comment_title:comment_title,comment_name:comment_name,comment_email:comment_email,comment_text:comment_text},
					type: "POST",
					dataType: "html",
					success:function(data) {
					   if(data == true)
                       {
                            
                       }
                       else
                       {
                        
                       }
					}
				});
        });
        
        <?php if(isset($_REQUEST["comment"]) && $_REQUEST["comment"] == true): ?>
            <?php if($room->isGoogleMap != 0): ?>
                $("#dev_tab_3").click();
            <?php else: ?>
                $("#dev_tab_2").click();
            <?php endif; ?>
        <?php endif; ?>
		if (!$.browser.opera) {
    
			// select element styling
			$('select.select').each(function(){
				var title = $(this).attr('title');
				if( $('option:selected', this).val() != ''  ) title = $('option:selected',this).text();
				$(this)
					.css({'z-index':10,'opacity':0,'-khtml-appearance':'none'})
					.after('<span class="select">' + title + '</span>')
					.change(function(){
						val = $('option:selected',this).text();
						$(this).next().text(val);
						})
			});

		};
		
	});
</script> 
<script type="text/javascript" src="skin/js/jquery-ui-1.8.17.custom.min.js"></script> 
<script type="text/javascript">

$(document).ready(function () {
$('#info-contact').tabs();
});
  </script> 
</body>
</html>